package com.hgd.igreencar.biz.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hgd.igreencar.biz.ICarInformationBiz;
import com.hgd.igreencar.dao.CarInformationMapper;
import com.hgd.igreencar.entity.CarInformation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarInformationBizImpl implements ICarInformationBiz {

    @Autowired
    private CarInformationMapper carInformationMapper;

    @Override
    public PageInfo<CarInformation> queryAllData(int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(carInformationMapper.queryAllData(currentPage,pageSize));
        return pageInfo;
    }

    @Override
    public PageInfo<CarInformation> queryAllOverData(int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(carInformationMapper.queryAllOverData(currentPage,pageSize));
        return pageInfo;
    }

    @Override
    public PageInfo<CarInformation> queryData(String areaName, String brandName, int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(carInformationMapper.queryData(areaName, brandName, currentPage, pageSize));
        return pageInfo;
    }

    @Override
    public PageInfo<CarInformation> queryByOver(String areaName, String brandName, int currentPage, int pageSize) {
        PageHelper.startPage(currentPage,pageSize);
        PageInfo pageInfo = new PageInfo(carInformationMapper.queryByOver(areaName, brandName, currentPage, pageSize));
        return pageInfo;
    }
}
